package com.zork.cmdb.webapi.mapper.cmdb;

import com.zork.cmdb.webapi.domain.dto.ModuleDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author chenjh
 * @date 2018/5/16
 * @description
 */
@Mapper
public interface ModuleMapper {

    @Select("SELECT [ModuleID]\n" +
            "      ,[ModuleName]\n" +
            "      ,[ModuleNum]\n" +
            "      ,[CategoryID]\n" +
            "      ,[ImageID]\n" +
            "      ,[IsUsable]\n" +
            "      ,[IsSystemDefined]\n" +
            "      ,[ParentID]\n" +
            "      ,[InstanceTableName]\n" +
            "      ,[CreateTime]\n" +
            "      ,[CreateUser] FROM [Module] ORDER BY [ModuleID]")
    List<ModuleDTO> listModule();

    @Select("SELECT [ModuleID]\n" +
            "      ,[ModuleName]\n" +
            "      ,[ModuleNum]\n" +
            "      ,[CategoryID]\n" +
            "      ,[ImageID]\n" +
            "      ,[IsUsable]\n" +
            "      ,[IsSystemDefined]\n" +
            "      ,[ParentID]\n" +
            "      ,[InstanceTableName]\n" +
            "      ,[CreateTime]\n" +
            "      ,[CreateUser] FROM [Module] WHERE [ModuleID] = #{moduleID} ORDER BY [ModuleID]")
    ModuleDTO getModule(@Param("moduleID") Integer moduleID);
}
